const mongoose = require('mongoose');
const {model, Schema} = mongoose;

const schema = new Schema({
  account: {type: String, index: true, unique: true},
  pwd: {type: String, index: true},
  nickname: {type: String, index: true},
  roles: {type: Array, index: true}, // 角色
  createTime: {type: Date, index: true, default: new Date()},
  updateTime: {type: Date, index: true, default: new Date()}
});

const User = model('user', schema);

module.exports = User;
